home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / quicktimeintro / wiredsprites / common files / qtutilities.h < prev    next >
Encoding:
Text File  |  2000-10-06  |  8.1 KB  |  262 lines

  1. //////////
  2. //
  3. //    File:        QTUtilities.h
  4. //
  5. //    Contains:    Some utilities for working with QuickTime movies.
  6. //                All utilities start with the prefix "QTUtils_".
  7. //
  8. //    Written by:    Tim Monroe
  9. //                Based on the DTSQTUtilities package by Apple DTS.
  10. //                This is essentially a subset of that package, revised for cross-platform use.
  11. //
  12. //    Copyright:    © 1996-1999 by Apple Computer, Inc., all rights reserved.
  13. //
  14. //    Change History (most recent first):
  15. //
  16. //       <2>         02/03/99    rtm        moved non-QTVR-specific utilities from QTVRUtilities to here
  17. //       <1>         09/10/97    rtm        first file
  18. //       
  19. //////////
  20.  
  21. #pragma once
  22.  
  23.  
  24. //////////
  25. //
  26. // header files
  27. //
  28. //////////
  29.  
  30. #ifndef __QTUtilities__
  31. #define __QTUtilities__
  32.  
  33. #ifndef __MOVIES__
  34. #include <Movies.h>
  35. #endif
  36.  
  37. #ifndef __MOVIESFORMAT__
  38. #include <MoviesFormat.h>
  39. #endif
  40.  
  41. #ifndef __MEDIAHANDLERS__
  42. #include <MediaHandlers.h>
  43. #endif
  44.  
  45. #ifndef __NUMBERFORMATTING__
  46. #include <NumberFormatting.h>
  47. #endif
  48.  
  49. #ifndef __QUICKTIMECOMPONENTS__
  50. #include <QuickTimeComponents.h>
  51. #endif
  52.  
  53. #ifndef __QUICKTIMEVR__
  54. #include <QuickTimeVR.h>
  55. #endif
  56.  
  57. #ifndef __QTSMOVIE__
  58. #include <QTSMovie.h>
  59. #endif
  60.  
  61. #ifndef __ENDIAN__
  62. #include <Endian.h>
  63. #endif
  64.  
  65. #ifndef __GESTALT__
  66. #include <Gestalt.h>
  67. #endif
  68.  
  69. #ifndef __FIXMATH__
  70. #include <FixMath.h>
  71. #endif
  72.  
  73. #ifndef __MACWINDOWS__
  74. #include <MacWindows.h>
  75. #endif
  76.  
  77. #ifndef __PRINTING__
  78. #include <Printing.h>
  79. #endif
  80.  
  81. #ifndef __SCRIPT__
  82. #include <Script.h>
  83. #endif
  84.  
  85. #ifndef __SOUND__
  86. #include <Sound.h>
  87. #endif
  88.  
  89. #ifndef _STRING_H
  90. #include <string.h>
  91. #endif
  92.  
  93. #ifndef _STDLIB_H
  94. #include <stdlib.h>
  95. #endif
  96.  
  97. #ifndef __TEXTUTILS__
  98. #include <TextUtils.h>
  99. #endif
  100.  
  101. #ifndef __TRAPS__
  102. #include <Traps.h>
  103. #endif
  104.  
  105.  
  106. //////////
  107. //
  108. // compiler flags
  109. //
  110. //////////
  111.  
  112. #define CONTENT_RATING_AVAIL        0            // is movie content-rating capability implemented?
  113.  
  114.  
  115. //////////
  116. //
  117. // constants
  118. //
  119. //////////
  120.  
  121. // constants used for QTUtils_SaveMovie
  122. #define kSavePrompt                    "Save Movie as:"
  123. #define kSaveMovieFileName            "untitled.mov"
  124. #define kSaveResName                "Movie Resource"
  125.  
  126. // constants used for QTUtils_PrintMoviePICT
  127. enum eQTUPICTPrinting {
  128.     kPrintFrame                        = 1, 
  129.     kPrintPoster                    = 2
  130. };
  131.  
  132. // constants used for QTUtils_GetMovieFileLoopingInfo
  133. enum {
  134.     kNormalLooping                    = 0, 
  135.     kPalindromeLooping                = 1, 
  136.     kNoLooping                        = 2
  137. };
  138.  
  139. #define kQTVideoEffectsMinVers        0x0300        // version of QT that first supports QT video effects
  140. #define kQTFullScreenMinVers        0x0209        // version of QT that first supports full-screen calls
  141. #define kQTWiredSpritesMinVers        0x0300        // version of QT that first supports wired sprites
  142.  
  143. // constants for GetQuickTimePreference/SetQuickTimePreference settings
  144. #define kConnectionSpeedPrefsType    FOUR_CHAR_CODE('cspd')
  145. #define kContentRatingPrefsType        FOUR_CHAR_CODE('crat')
  146.  
  147. enum {
  148.     kQTUtilsSpeakerButton             = mcFlagSuppressSpeakerButton,
  149.     kQTUtilsStepButtons             = mcFlagSuppressStepButtons,
  150.     kQTUtilsBackButton                 = mcFlagQTVRSuppressBackBtn,
  151.     kQTUtilsZoomButtons             = mcFlagQTVRSuppressZoomBtns,
  152.     kQTUtilsHotSpotButton             = mcFlagQTVRSuppressHotSpotBtn,
  153.     kQTUtilsTranslateButton         = mcFlagQTVRSuppressTranslateBtn,
  154.     kQTUtilsHelpText                 = mcFlagQTVRSuppressHelpText,
  155.     kQTUtilsHotSpotNames             = mcFlagQTVRSuppressHotSpotNames,
  156.     kQTUtilsCustomButton             = mcFlagsUseCustomButton,
  157.  
  158.     // these are to support existing code that uses our older names
  159.     kQTVRSpeakerButton                 = mcFlagSuppressSpeakerButton,
  160.     kQTVRBackButton                 = mcFlagQTVRSuppressBackBtn,
  161.     kQTVRZoomButtons                 = mcFlagQTVRSuppressZoomBtns,
  162.     kQTVRHotSpotButton                 = mcFlagQTVRSuppressHotSpotBtn,
  163.     kQTVRTranslateButton             = mcFlagQTVRSuppressTranslateBtn,
  164.     kQTVRHelpText                     = mcFlagQTVRSuppressHelpText,
  165.     kQTVRHotSpotNames                 = mcFlagQTVRSuppressHotSpotNames,
  166.     kQTVRCustomButton                 = mcFlagsUseCustomButton
  167. };
  168.  
  169. // default window position
  170. #ifndef kDefaultWindowX
  171. #define kDefaultWindowX                50
  172. #endif
  173.  
  174. #ifndef kDefaultWindowY
  175. #define kDefaultWindowY                50
  176. #endif
  177.  
  178.  
  179. //////////
  180. //
  181. // data types
  182. //
  183. //////////
  184.  
  185. #if CONTENT_RATING_AVAIL
  186. // structure of content rating data for GetQuickTimePreference
  187. struct ContentRatingPrefsRecord {
  188.     UInt16                            fContentRating;
  189.     UInt16                            fContentTypes;
  190. };
  191. typedef struct ContentRatingPrefsRecord ContentRatingPrefsRecord;
  192. #endif
  193.  
  194.  
  195. //////////
  196. //
  197. // function prototypes
  198. //
  199. //////////
  200.  
  201. Boolean                        QTUtils_TrapAvailable (short theTrapWord);
  202. Boolean                        QTUtils_IsQuickTimeInstalled (void); 
  203. Boolean                        QTUtils_IsQuickTimeCFMInstalled (void);
  204. long                        QTUtils_GetQTVersion (void);
  205. Boolean                        QTUtils_HasQuickTimeVideoEffects (void);
  206. Boolean                        QTUtils_HasFullScreenSupport (void);
  207. Boolean                        QTUtils_HasWiredSprites (void);
  208. Boolean                        QTUtils_IsQTVRMovie (Movie theMovie);
  209. Boolean                        QTUtils_IsStreamedMovie (Movie theMovie);
  210. Boolean                        QTUtils_IsControllerBarVisible (MovieController theMC); 
  211. short                        QTUtils_GetControllerBarHeight (MovieController theMC);
  212. void                        QTUtils_HideControllerBar (MovieController theMC);
  213. void                        QTUtils_ShowControllerBar (MovieController theMC);
  214. void                        QTUtils_ToggleControllerBar (MovieController theMC);
  215. void                        QTUtils_PutControllerBarOnTop (MovieController theMC);
  216. void                        QTUtils_HideControllerButton (MovieController theMC, long theButton); 
  217. void                        QTUtils_ShowControllerButton (MovieController theMC, long theButton); 
  218. void                        QTUtils_ToggleControllerButton (MovieController theMC, long theButton);
  219. void                        QTUtils_ResetControllerButton (MovieController theMC, long theButton);
  220. void                        QTUtils_ShowCustomButton (MovieController theMC);
  221. Boolean                        QTUtils_IsControllerButtonVisible (MovieController theMC, long theButton);
  222. Boolean                        QTUtils_IsMediaTypeInMovie (Movie theMovie, OSType theMediaType);
  223. Boolean                        QTUtils_MovieHasTimeCodeTrack (Movie theMovie);
  224. Boolean                        QTUtils_MovieHasSoundTrack (Movie theMovie);
  225. MediaHandler                QTUtils_GetSoundMediaHandler (Movie theMovie);
  226. OSErr                        QTUtils_UpdateMovieVolumeSetting (Movie theMovie);
  227. OSErr                        QTUtils_SelectAllMovie (MovieController theMC);
  228. OSErr                        QTUtils_SelectNoneMovie (MovieController theMC);
  229. ImageDescriptionHandle        QTUtils_MakeSampleDescription (long theEffectType, short theWidth, short theHeight);
  230. OSErr                        QTUtils_GetContentRatingFromMovie (Movie theMovie, UInt16 *theRating, UInt32 *theReasons);
  231. OSErr                        QTUtils_AddContentRatingToMovie (Movie theMovie, UInt16 theRating, UInt32 theReasons);
  232. OSErr                        QTUtils_AddUserDataTextToMovie (Movie theMovie, char *theText, OSType theType);
  233. OSErr                        QTUtils_AddCopyrightToMovie (Movie theMovie, char *theText);
  234. OSErr                        QTUtils_AddMovieNameToMovie (Movie theMovie, char *theText);
  235. OSErr                        QTUtils_AddMovieInfoToMovie (Movie theMovie, char *theText);
  236. OSErr                        QTUtils_GetMovieFileLoopingInfo (Movie theMovie, long *theLoopInfo);
  237. OSErr                        QTUtils_SetMovieFileLoopingInfo (Movie theMovie, long theLoopInfo);
  238. OSErr                        QTUtils_SetLoopingStateFromFile (Movie theMovie, MovieController theMC);
  239. OSErr                        QTUtils_MakeMovieLoop (Movie theMovie, Boolean isPalindrome);
  240. OSErr                        QTUtils_GetWindowPositionFromFile (Movie theMovie, Point *thePoint);
  241. char *                        QTUtils_GetTrackName (Track theTrack);
  242. OSErr                        QTUtils_SetTrackName (Track theTrack, char *theText);
  243. char *                        QTUtils_MakeTrackNameByType (Track theTrack);
  244. Boolean                        QTUtils_IsImageFile (FSSpec *theFSSpec);
  245. Boolean                        QTUtils_IsMovieFile (FSSpec *theFSSpec);
  246. void                        QTUtils_ConvertFloatToBigEndian (float *theFloat);
  247. StringPtr                    QTUtils_ConvertCToPascalString (char *theString);
  248. char *                        QTUtils_ConvertPascalToCString (StringPtr theString);
  249. OSErr                        QTUtils_DeleteAllReferencesToTrack (Track theTrack);
  250. TimeValue                    QTUtils_GetFrameDuration (Track theTrack);
  251. long                        QTUtils_GetFrameCount (Track theTrack);
  252. void                        QTUtils_GetMaxWindowDepth (CWindowPtr theWindow, short *thePixelType, short *thePixelSize);
  253. void                        QTUtils_GetMaxScreenDepth (Rect *theGlobalRect, short *thePixelType, short *thePixelSize);
  254. long                        QTUtils_GetUsersConnectionSpeed (void);
  255. OSErr                        QTUtils_SetUsersConnectionSpeed (long theSpeed);
  256. OSErr                        QTUtils_GetUsersContentRating (UInt32 *theType, UInt16 *theRating);
  257. OSType                        QTUtils_GetControllerType (Movie theMovie);
  258. OSErr                        QTUtils_SetControllerType (Movie theMovie, OSType theType);
  259. MovieController                QTUtils_ChangeControllerType (MovieController theMC, OSType theType, long theFlags);
  260.  
  261. #endif    // __QTUtilities__
  262.